//
//  DPWalletBindAliAccountCell.swift
//  DoctorEPlus
//
//  Created by 王林波 on 2021/3/8.
//

import UIKit

class DPWalletBindAliAccountCell: UITableViewCell {
    
    var bindAlipayAccountBlock:(() -> Void)?
    
    @IBOutlet weak var iconImageView: UIImageView!
    var model: DPWalletAlipayInfoModel! {
        didSet {
            if model.alipayUserId.isEmpty == true { // 没有绑定
                self.bindAlipayActLab.text = "立即绑定"
                self.iconImageView.isHidden = true
            }else {
                self.bindAlipayActLab.text = model.alipayNickName
                self.iconImageView.isHidden = false
                self.iconImageView.sd_setImage(with: URL.init(string: model.alipayAvatar), completed: nil)
            }
        }
    }
    
    
    override func awakeFromNib() {
        super.awakeFromNib()
        self.iconImageView.addLayerCorner(15, 0, .white)
        self.bindAlipayActLab.addViewAction {[weak self] (_) in
            if self?.model.alipayUserId.isEmpty == true {
                self?.bindAlipayAccountBlock?()
            }
        }
    }
    @IBOutlet weak var bindAlipayActLab: UILabel!
    
    
    
    
    
    
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
    static var cellHeight: CGFloat {
        get {
            return 60
        }
    }
}
